/****************************************
 *	PictureNumber
 *	下午04:06:23
 *	by Jane
 ****************************************/
package com.swfgui.controls
{
	import com.swfgui.containers.Canvas;
	
	import flash.display.DisplayObject;

	public class PictureNumber extends Canvas
	{
		private var m_value :int;
		public function PictureNumber(viewSource:Object=null)
		{
			super(viewSource);
		}
		
		override public function dispose():void
		{
			if (hasDisposed)
			{
				return;
			}
			
			super.dispose();
		}
		
		override protected function initialize():void
		{
			super.initialize();
			this.autoLayout = false;
		}
		
		public function set value(v:int):void
		{
			m_value = v;
			var childArr :Array = this.getAllChild();
			for each(var c:DisplayObject in childArr)
			{
				c.visible = false;
			}
			for(var i:int=0;i<m_value.toString().length;i++)
			{
				var num :int = int(m_value.toString().charAt(i))+1;
				if(view['p'+i])
				{
					view['p'+i].gotoAndStop(num);
					view['p'+i].visible = true;
				}
			}
		}
		
		public function get value():int
		{
			return m_value;
		}
		
	}
}